package com.adv.ems.model.vo;

import com.adv.ems.enums.DateTypeEnum;
import lombok.Data;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Data
public class ReportMeterExcelVO {
    private List<Info> list;
    private String cashUnite;
    private String standUnite;

    public ReportMeterExcelVO() {
        this.list = new ArrayList<Info>();
    }

    @Data
    public static class Info {
        private String subjectName;
        private String energyUnit;
        private List<DateInfo> dateInfos;

        public Info() {
            this.dateInfos = new ArrayList<DateInfo>();
        }
    }

    @Data
    public static class DateInfo {
        private String userDate;
        private List<Item> items;
        private Map<String, Item> map;

        public DateInfo(DateTypeEnum dateType) {
            this.items = new ArrayList<Item>();
            this.map = new HashMap<String, Item>();
            if (dateType.equals(DateTypeEnum.day)) {
                for (int i = 0; i < 24; i ++) {
                    String key = Integer.toString(i);
                    if (i <= 9) {
                        key = "0" + key;
                    }
                    Item dateInfo = new Item();
                    dateInfo.setColDate(key);
                    this.items.add(dateInfo);
                    this.map.put(key, dateInfo);
                }
            }else if (dateType.equals(DateTypeEnum.month)) {
                for (int i = 1; i <= 31; i ++) {
                    String key = Integer.toString(i);
                    if (i <= 9) {
                        key = "0" + key;
                    }
                    Item dateInfo = new Item();
                    dateInfo.setColDate(key);
                    this.items.add(dateInfo);
                    this.map.put(key, dateInfo);
                }
            }else {
                for (int i = 1; i < 13; i ++) {
                    String key = Integer.toString(i);
                    if (i <= 9) {
                        key = "0" + key;
                    }
                    Item dateInfo = new Item();
                    dateInfo.setColDate(key);
                    this.items.add(dateInfo);
                    this.map.put(key, dateInfo);
                }
            }
        }
    }

    @Data
    public static class Item {
        private String colDate;
        private Double fromValue;
        private Double toValue;
        private Double increaseRealValue;
        private Double increaseStandValue;
        private Double increaseCashValue;

        public Item() {
        }
    }
}
